package com.ymatou.iapi.trading.userquery.service;

import org.json.JSONObject;

import com.ymatou.iapi.trading.userquery.parameter.resp.GetConsultingOrderInfoResp;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;

/**
 * 获取待咨询订单  Template自动生成代码
 */
public class GetConsultingOrderInfoCall extends YmatouBaseCall {
	private static String opurl = "api/app/GetConsultingOrderInfo";

	public GetConsultingOrderInfoCall() {
		super(EnvSetup.getSystemUrl("userquery_iapi"), opurl, "POST", "JSON");
	}

	@Override
	public void addDefHeader() {
		// super.addDefHeader();
		client.addHeader("Accept",
				"text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	/**
	 * 获取code
	 */
	public String getCode() {
		String Code = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Code = String.valueOf(jo.get("code"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取Data
	 * 
	 * @return Data
	 */
	public JSONObject getData() {
		JSONObject Data = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Data = jo.getJSONObject("data");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Data;
	}

	/**
	 * 获取Msg
	 * 
	 * @return
	 */
	public String getMsg() {
		String Msg = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Msg = String.valueOf(jo.get("msg"));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Msg;
	}

	/**
	 * 
	 * @return
	 */
	public GetConsultingOrderInfoResp getConsultingOrderInfoResp() {
		GetConsultingOrderInfoResp resp = null;
		try {
			resp = (GetConsultingOrderInfoResp) FormatUtil.GSONToObject(
					getData().toString(), GetConsultingOrderInfoResp.class);
		} catch (Exception e) {

			e.printStackTrace();
		}
		return resp;
	}

}
